#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1405,mod = 998244353;
inline int qpow(int x,int y)
{
	int res = 1;
	while(y)
	{
		if(y&1) res = res*x%mod;
		y>>=1;
		x = x*x%mod; 
	}
	return res;
}
int n,a[N],b[N],p[N],ans[N];
signed main()
{
	freopen("traffic.in","r",stdin);
	freopen("traffic.out","w",stdout);
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin>>n;
	int l = 0;
	for(int i = 1;i<=n;i++)
	{
		cin>>p[i]>>a[i]>>b[i];
		if(!l) l = a[i]+b[i];
		else l = l*(a[i]+b[i])/__gcd(l,a[i]+b[i]); 
	}
	for(int i = 0;i<l;i++)
	{
		int now = i;
		bool fl = 1;
		for(int j = 1;j<=n;j++)
		{
			now+=p[j]-p[j-1];
			if(now%(a[j]+b[j])<a[j])
			{
				ans[j]++,fl = 0;
				break;
			}
		}
		if(fl) ans[n+1]++;
	}
	int inv = qpow(l,mod-2);
	for(int i = 1;i<=n+1;i++)
		cout<<ans[i]*inv%mod<<'\n';
	return 0;
}

